package q1051_heightChecker;

import java.util.Arrays;

public class Solution_1 {
    public int heightChecker(int[] heights) {
        int[] actualHeights = new int[heights.length];
        System.arraycopy(heights,0,actualHeights,0,heights.length);
        Arrays.sort(actualHeights);
        int count = 0;
        for (int i = 0; i < heights.length; i++) {
            count += heights[i] != actualHeights[i] ? 1 : 0;
        }
        return count;
    }
}
